package com.admgt.profile.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "profiles")
public class Profile implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private String profileId;
	private String name;
	private Date createTime;
	
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy =  "uuid" )
	@Column(name = "profileId", nullable=false)
	public String getProfileId() {
		return profileId;
	}
	public void setProfileId(String profileId) {
		this.profileId = profileId;
	}
	@Column(name = "name", nullable = false)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "createTime", nullable = false)
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj==null)return false;
		if(this==obj)return true;
		if(obj instanceof Profile){
			Profile other = (Profile)obj;
			return this.profileId == other.profileId;
		}
		return false;
	}
	@Override
	public int hashCode() {
		return Integer.parseInt(profileId);
	}
	@Override
	public String toString() {
		return name;
	}
	
	
}
